package com.example.common.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MobileNumberValidator implements ConstraintValidator<MobileNumber, String> {

    @Override
    public boolean isValid(String phoneField, ConstraintValidatorContext context) {

        if (phoneField == null) return true; // can be null

        return phoneField.matches("1[0-9]{10}");
    }
}
